package com.triones.ljr.controller.api;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.triones.ljr.entity.dto.BannerDO;
import com.triones.ljr.entity.vo.CustomApiCollectVO;
import com.triones.ljr.entity.vo.CustomCollectVO;
import com.triones.ljr.entity.vo.CustomDeclareAuditVO;
import com.triones.ljr.service.CollectService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

/**
 * api - 我的收藏
 *
 * @Author: triones
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/collect")
public class ApiCollectController extends BaseController {

    private final CollectService collectService;

    /**
     * 收藏/取消收藏
     * status 1:收藏、0：取消收藏
     */
    @PostMapping("/click")
    public R<Void> collect(@NotNull(message = "政策id不能为空") Long pId,@NotNull(message = "状态不能为空") Integer status) {
        return toAjax(collectService.collect(pId,status));
    }

    /**
     * 我的收藏列表（分页）
     * @param status
     * @return
     */
    @GetMapping("/myList")
    public TableDataInfo<CustomApiCollectVO> apiCollectPageList(String status, PageQuery pageQuery) {
        return collectService.apiCollectPageList(status, pageQuery);
    }
}
